﻿using FastReport;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ZK.YCGLRD_TransManage.Test
{
    public partial class FastReport打印 : Form
    {
        public FastReport打印()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            AA aA = new AA()
            {
                Id = 1,
                BB = true,
                ListInt = new List<int>() { 1, 2, 3 },
                Name = "lcwwww",
                Time = DateTime.Now,
            };

            List<AA> aAs = new List<AA>();
            // dataGridModels.Add(bill);
            aAs.Add(aA);
            aAs.Add(aA);
            aAs.Add(aA);

            Report report = new Report();
            report.Load(@"aAs.frx");
            report.RegisterData(aAs, "aAs");
            /*
             在fastreport中赋值的时候需要[] 包起来。
             */

            //静默打印
            //report.PrintSettings.ShowDialog = true;//选择打印机页面是否显示
            //report.PrintSettings.Printer = @"\\WANGWEI-PC\Brother MFC-7380";
            //report.Print();
            //report.Dispose();

            //预览打印
            report.Show();
            report.Dispose();

        }
    }

    public class AA
    {
        public int Id { get; set; }
        public DateTime Time { get; set; }
        public string Name { get; set; }
        public bool BB { get; set; }
        public List<int> ListInt { get; set; }
    }
}
